Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1480775 Collect Span Info from Copyable and Updatable Dataframes #119

Merged
merged 9 commits into from
Jul 12, 2024

Conversation

sfc-gh-bli
Copy link
Collaborator

  1. Collect Span Info from Copyable and Updatable Dataframes
  2. Improve the test function to automatically detect line numbers
  3. Add Java offset to action functions

@sfc-gh-bli sfc-gh-bli requested a review from sfc-gh-yuwang July 11, 2024 23:24
@@ -12,21 +12,17 @@ object OpenTelemetry extends Logging {
val spanInfo = new DynamicVariable[Option[SpanInfo]](None)

// wrapper of all action functions
def action[T](className: String, funcName: String, isScala: Boolean)(func: => T): T = {
def action[T](className: String, funcName: String, isScala: Boolean, javaOffSet: Int = 0)(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

introduced javaOffset parameter. In some cases, Java API wrapped more than one layers on Scala API.

@@ -366,4 +440,15 @@ class OpenTelemetrySuite extends OpenTelemetryEnabled {
}

private val stageName1 = randomName()

def checkSpan(className: String, funcName: String, methodChain: String): Unit = {
val stack = Thread.currentThread().getStackTrace
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I improved this function, now, it can automatically detect line numbers in tests.

Copy link
Contributor

@sfc-gh-yuwang sfc-gh-yuwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like only a few action functions needs offset. I feel like it is a bit fragile since change of the way calling action function could break the offset. Do you think we are going to make changes on the way we call those action functions in the future?

@sfc-gh-bli
Copy link
Collaborator Author

Looks like only a few action functions needs offset. I feel like it is a bit fragile since change of the way calling action function could break the offset. Do you think we are going to make changes on the way we call those action functions in the future?

val index = if (isScala) 4 else 5 + javaOffSet
val fileName = stacks(index).getFileName
val lineNumber = stacks(index).getLineNumber

Default stack index of Scala API is 4, and the Java One is 5.
Offset is related the default Java API index(5), default value of offset is 0.

In future if the change of action function impacts those indices, we only need change the default value (4 and 5) from the action function. I will not impact the offset.

@sfc-gh-bli sfc-gh-bli merged commit ef78860 into main Jul 12, 2024
15 checks passed
@sfc-gh-bli sfc-gh-bli deleted the snow-1480775 branch July 12, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants